<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateClassesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('classes', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('category_id')->default(0)->comment('分类id');
            $table->unsignedInteger('course_id')->default(0)->comment('课程id');
            $table->string('name',100)->default('')->comment('课时名称');
            $table->unsignedInteger('count')->default(0)->comment('观看次数');
            $table->decimal('price')->default(0)->comment('价格，2位小数');
            $table->string('url',255)->default('')->comment('播放地址');
            $table->string('cover',255)->default('')->comment('封面图片url');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('classes');
    }
}
